/**************************************************************************//**
*
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date            Author           Notes
* 2021-2-7        Wayne            First version
*
******************************************************************************/

#ifndef __DRV_SPI_H__
#define __DRV_SPI_H__

#include <rtdevice.h>
#include <rtconfig.h>

#include <nuc970_spi.h>
#include <nu_bitutil.h>

struct nu_spi
{
    struct rt_spi_bus dev;
    char *name;
    SPI_TypeDef *spi_base;
    uint32_t dummy;

    struct rt_spi_configuration  configuration;
};

typedef struct nu_spi *nu_spi_t;

rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t cs_pin);

#endif // __DRV_SPI_H___
